package com.eastedu.superise;

import cn.hutool.extra.spring.SpringUtil;
import org.springframework.jdbc.core.JdbcTemplate;

/**
 * The type Jdbc template provider.
 *
 * @author superman
 */
public class JdbcTemplateProvider {

    /**
     * Get jdbc template.
     *
     * @param clazz the clazz
     * @return the jdbc template
     */
    public static JdbcTemplate get(Class<?> clazz) {
        return SpringUtil.getBean(JdbcTemplate.class);
    }

    private static String getJdbcBeanName(Class<?> clazz) {
        String tempName = clazz.getSimpleName().replaceAll("[A-Z]", "_$0");
        return tempName.split("_")[1].toLowerCase() + "JdbcTemplate";
    }

}
